<html>
<head>
    <css file="__PUBLIC__/css/body.css"/>
    <css file="__STATIC__/icon/icon.css"/>
    <js file="__STATIC__/jquery-1.7.2.min.js"/>
    <css file="__STATIC__/kindeditor/themes/default/default.css" />
    <js file="__STATIC__/kindeditor/kindeditor-min.js"/>
    <js file="__STATIC__/kindeditor/lang/zh_CN.js"/>
    <css file="__STATIC__/uploadify/uploadify.css"/>
    <js file="__STATIC__/uploadify/jquery.uploadify.js"/>
    <js file="__STATIC__/My97DatePicker/WdatePicker.js"/>
      <script type="text/javascript">
        $(function(){
                var url1="{:U('Upload/upload_ke_json','',0)}";
                var url2="{:U('Upload/upload_ke_manager','',0)}";
                var editor;
    			KindEditor.ready(function(K) {
    				editor = K.create('.elem1', {
                        uploadJson : url1,
                        fileManagerJson : url2,
                        allowFileManager : true
    				});
    			});
        });   
       function checkboxx(x,_this){
            obj=$('#'+x);
            if($(_this).attr("checked")){
                obj.val(1);
            }else{
                obj.val(0);
            }
       }                       
    </script>
    <style type="text/css">
        .upload{
            list-style-type: none;
            margin:0px;
            padding:0px;
        }
        .upload li{
            float:left;
        }
    </style>
</head>
<body>
<form action="{:U('Advert/amodifyhandle')}" method="post">
    <div class="top">
        <div class="position"><span class="icon icon-31"></span>当前位置：修改广告</div>
        <div class="top-title">
            <span class="icon icon-32"></span>
            <div class="top-tool">
                <input type="submit" class="button-b" value="提交保存"/>
                <input type="hidden" value="{$body.id}" name="id"/>
                <input type="hidden" value="{$body.pid}" name="pid"/>
            </div>
        </div>
    </div>
    <div class="body">
        <table class="list-tb tableTd" border="0" cellpadding="0" cellspacing="4">
            <tr>
                <td width="10%" class="textRight">名称：</td>
                <td>
                    <input type="text" name="title" value="{$body.title}"/>
                </td>
            </tr>
            <tr>
                <td class="textRight">是否启用：</td>
                <td>
                    <input type="radio" name="ls" <if condition="$body['ls']==1">checked=""</if> value="1"/>启用
                    <input type="radio" name="ls" <if condition="$body['ls']==0">checked=""</if> value="0"/>禁用
                </td>
            </tr>
            <tr>
                <td class="textRight">排序：</td>
                <td>
                    <input name="orders" value="{$body.orders}"/>
                </td>
            </tr>
            <foreach name="fields" item="v">
                    <if condition="$v.ftype eq 1">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td> 
                                <input type="text" name="{$v.tag}" value="{$body[$v[tag]]}"/>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 2">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td>
                                <textarea class="elem1" style="width:700px;height:300px;" name="{$v.tag}">{$body[$v[tag]]}</textarea>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 3">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td> 
                                <input type="text" name="{$v.tag}" value="{$body[$v[tag]]}"/>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 4">
                         <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td> 
                                <script>
                                    $(function() {
                                    	$("#{$v.tag}_s").uploadify({
                                    		height        : 22,
                                    		swf           : '__STATIC__/uploadify/uploadify.swf',
                                    		uploader      : '{:U("Upload/upload_tp")}',
                                    		width         : 60,
                                            multi         :false, //ture多文件，false单文件
                                            queueID:'uploadify_ppt',
                                            buttonText:'',
                                            removeCompleted : true,
                                            'onUploadSuccess':function(file,data,response){
                                                    if(data=='error') 
                                                    {
                                                        alert('上传出错，请检查原因!(文件大小/文件类型)');
                                                    }
                                                    else
                                                    {
                                                        $('#{$v.tag}').val(data);
                                                    }
                                            }
                                    	});
                                    });
                                </script>
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td><input style="margin: 0px;margin-top:2px;" type="text" name="{$v.tag}" id="{$v.tag}" readOnly="true" value="{$body[$v[tag]]}"/></td>
                                        <td style="padding-top: 3px;padding-left:3px;"><input type="file" name="{$v.tag}_s" id="{$v.tag}_s"/></td>
                                        <td><div id="uploadify_ppt" style="width:400px;margin-left:5px;"></div></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 5">
                       
                    </if>
                    <if condition="$v.ftype eq 6">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td> 
                                <input type="text" name="{$v.tag}" readOnly="true"  class="Wdate" value="{$body[$v[tag]]}" onclick="WdatePicker()"/>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 7">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td>
                                <input style="float: left;" onclick="checkboxx('{$v.tag}',this)" type='checkbox' <if condition="$body[$v['tag']] eq 1">checked="checked"</if>/>
                                <input type="hidden" id="{$v.tag}" name='{$v.tag}' <if condition="$body[$v['tag']] eq 1"> value="1"</if>/>
                            </td>
                        </tr>
                    </if>
                    <if condition="$v.ftype eq 8">
                        <tr>
                            <td class="textRight">{$v.title}：</td>
                            <td>
                                    <textarea style="float:left;margin:4px 0px;" name="{$v.tag}">{$body[$v[tag]]}</textarea>
                                    <div style="clear: both;"></div>
                            </td>
                        </tr>
                    </if>
                </foreach>
        </table>
    </div>
</form>
</body>
</html>